﻿using System;
using System.Web.UI.WebControls;
using System.Data;

public partial class NPS_app_MasterData_Activity : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            ltrTitle.Text = "Master Data: Activity Name";
            DataTable dt = GetData();
            GridView1.DataSource = dt;
            GridView1.DataBind();
            setPanel();
            pnlView.Visible = true;
        }
    }

    private void setPanel()
    {
        pnlView.Visible = false;
        pnlCreate.Visible = false;
        pnlEdit.Visible = false;
        pnlDetails.Visible = false;
        pnlDelete.Visible = false;
    }

    protected void OnPaging(object sender, GridViewPageEventArgs e)
    {
        GridView1.PageIndex = e.NewPageIndex;
        GridView1.DataBind();
    }

    protected void OnRowCommand_Click(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName == "Editing")
        {
            //int index = Convert.ToInt32(e.CommandArgument);
            //GridViewRow row = GridView1.Rows[index];
            setPanel();
            pnlEdit.Visible = true;
            ltrTitle.Text = "Master Data: Activity Name Edit";
        }
        else if (e.CommandName == "Details")
        {
            setPanel();
            pnlDetails.Visible = true;
            ltrTitle.Text = "Master Data: Activity Name Details";
        }
        else if (e.CommandName == "Deleting")
        {
            setPanel();
            pnlDelete.Visible = true;
            ltrTitle.Text = "Master Data: Activity Date Delete";
        }

    }

    private DataTable GetData()
    {
        DataTable dt = new DataTable();
        dt.Columns.Add("ID");
        dt.Columns.Add("Activity_name");
        dt.Columns.Add("Deskripsi");
        dt.Columns.Add("Kuota");

        for (int i = 0; i < 1000; i++)
        {
            dt.Rows.Add(new object[] { i + 1, "Seminar", "Pengajaran memiliki fokus khusus", "50" });
            i++;
            dt.Rows.Add(new object[] { i + 1, "Expo", "", "50" });
            i++;
            dt.Rows.Add(new object[] { i + 1, "Newslatter", "", "10" });
        }
        return dt;
    }

    protected void btnCreate_Click(object sender, EventArgs e)
    {
        setPanel();
        pnlCreate.Visible = true;
        ltrTitle.Text = "Master Data: Activity Name Create";
    }
    protected void btnFilter_Click(object sender, EventArgs e)
    {
    }
    protected void btnCSave_Click(object sender, EventArgs e)
    {
    }
    protected void btnCCancel_Click(object sender, EventArgs e)
    {
        setPanel();
        pnlView.Visible = true;
        ltrTitle.Text = "Master Data: Activity Name";
    }
    protected void btnESave_Click(object sender, EventArgs e)
    {
    }
    protected void btnECancel_Click(object sender, EventArgs e)
    {
        setPanel();
        pnlView.Visible = true;
        ltrTitle.Text = "Master Data: Activity Name";
    }
    protected void btnDEdit_Click(object sender, EventArgs e)
    {
    }
    protected void btnDBack_Click(object sender, EventArgs e)
    {
        setPanel();
        pnlView.Visible = true;
        ltrTitle.Text = "Master Data: Activity Name";
    }
    protected void btnDelete_Click(object sender, EventArgs e)
    {
    }
    protected void btnBack_Click(object sender, EventArgs e)
    {
        setPanel();
        pnlView.Visible = true;
        ltrTitle.Text = "Master Data: Activity Name";
    }
}
